<template>
  <div class="input-box">
    <div class="mask-div" v-if="inputMessage.is_show">
      <div class="mask-bg" @click="inputMessage.is_show = false"></div>
      <div class="content">
        <img src="@/assets/miyaoguanli06.png" class="close" alt="" @click="inputMessage.is_show = false">
        <p class="title">{{inputMessage.title}}</p>
        <p class="tip"><input type="text" v-model="inputMessage.sendCon" :placeholder="inputMessage.tip" maxlength="4"></p>
        <span class="btn" @click="sendMsg">{{inputMessage.btn}}</span>
      </div>
    </div>
  </div>
</template>

<script>

  export default {
    components: {
    },
    props: {
      'inputMessage': {
        type: Object,
        required: true,
        default: function () {
          let message = {
            title: '请输入密钥备注',
            tip: '请输入备注名称（不超过4个字）',
            btn: '确认',
            is_show: false,
            num: 0,
            sendCon: '密钥1'
          }
          return message
        }
      },
    },
    data () {
      return {
        is_show: false,
      }
    },
    created () {
    },
    methods: {
      clickBtn () {
        this.inputMessage.is_show = false
        this.$router.push(this.inputMessage.path)
      },
      sendMsg () {
        var sendCons = {
          id: this.inputMessage.num,
          sendCon: this.inputMessage.sendCon
        }
        this.$emit('sendMsgs', sendCons)
        this.inputMessage.is_show = false
      }
    }
  }
</script>

<style lang="stylus" scoped>
  .input-box
    .content
      width 92%
      left 4%
      background-color #fff
      border-radius .3rem
      text-align center
      top 15.4rem
      padding 0 1.3rem
      padding-bottom 1.7rem
      box-sizing border-box
      .close
        position absolute
        width 2.3rem
        right 1.3rem
        top 1.6rem
      .title
        font-size 1.7rem
        line-height 1.7rem
        height 1.7rem
        color #333
        font-weight 500
        margin-top 2.2rem
        margin-bottom 2.5rem
      .tip
        input
          border 1px solid #ccc
          height 4.8rem
          line-height 4.8rem
          color #333
          width 100%
          border-radius .3rem
          padding-left 1.7rem
          box-sizing border-box
          outline none
      .btn
        height 5rem
        line-height 5rem
        display block
        width 100%
        color #fff
        font-size 1.7rem
        text-align center
        margin-top 1.7rem
        background-color #172F6D
        border-radius 100px
</style>
